package com.changgou.search.listener;

import com.changgou.search.service.SkuSearchService;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
* @Author: 少迪
* @Date: Created in 2019-08-09 11:14
* @Description:
* @Version: 1.0
*/

@Component
@RabbitListener(queues = "search_add_queue")
public class SkuSearchListener {

    @Autowired
    private SkuSearchService skuSearchService;

    @RabbitHandler
    public void searchAdd(String message){
        System.out.println("接收到消息："+message);
        try{
            skuSearchService.importSkuListBySpuId( message );
        }catch (Exception e){
            e.printStackTrace();
        }
    }

}
